class Solution {
public:

	bool IsLetter(char ch){
		if (ch <= 'z'&&ch >= 'a')
			return true;
		if (ch >= 'A'&&ch <= 'Z')
			return true;
		return false;
	}

	string reverseOnlyLetters(string s) {
		int begin = 0;
		int end = s.size() - 1;
		while (begin<end){
			while (begin<end&&!IsLetter(s[begin])){
				begin++;
			}

			while (begin<end&&!IsLetter(s[end])){
				end--;
			}

			swap(s[begin], s[end]);
			begin++;
			end--;

		}

		return